﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Omes.Services;

namespace FashionMural.Admin
{
    public partial class SystemDesktop : System.Web.UI.Page
    {
        public string AdminName { get; set; }

        public string DisplayName { get; set; }

        public string NowDateTime { get; set; }

        public string PreDateTime { get; set; }

        public string NowLoginIp { get; set; }

        public string PreLoginIp { get; set; }

        protected void Page_Load(object sender, EventArgs e)
        {
            if(!Page.IsPostBack)
            {
                try
                {
                    AdminName = Session["admin"].ToString();
                    Omes.Services.DbServer db = new DbServer();
                    if(!string.IsNullOrEmpty(AdminName))
                    {
                        Omes.Model.AdminInfo adminInfo = db.GetAdminInfo(AdminName)[0];
                        DisplayName = adminInfo.DisplayName;
                        NowDateTime = DateTime.Now.ToString();
                        Omes.Services.DbServer db1 = new DbServer();
                        Omes.Model.LoginRecord record = db1.GetCurrentLoginRecord();
                        NowLoginIp = Request.UserHostAddress;
                        PreLoginIp = record.LoginIp;
                        PreDateTime = record.LoginTime.ToString();
                    }
                }
                catch (Exception)
                {
                    
                    throw;
                }
            }
        }
    }
}